package com.aloha.auth.controller;

import com.aloha.auth.annotation.CheckPermission;
import com.aloha.auth.support.CheckMode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author zhdai
 * @date 2023/11/9 21:52
 */
@CheckPermission(value = "test.*")
@RestController
@RequestMapping("/01")
public class Test01Controller {

    @GetMapping("/01")
    public Object test01() {
        return new HashMap<String, Object>() {{
            put("id", 1001);
            put("username", "dk1");
        }};
    }

    @GetMapping("/02")
    public Object test02() {
        return new HashMap<String, Object>() {{
            put("id", 1002);
            put("username", "dk2");
        }};
    }

    @GetMapping("/03")
    public Object test03() {
        return new HashMap<String, Object>() {{
            put("id", 1003);
            put("username", "dk3");
        }};
    }

    @CheckPermission("user.delete")
    @GetMapping("/04")
    public Object test04() {
        return new HashMap<String, Object>() {{
            put("id", 1004);
            put("username", "dk4");
        }};
    }
}
